<template>
  <div>
    <ul class="cart-bg" v-if="show" >
      <li class="cart-list">
        <p class="list-top">颜色</p>
        <ul class="list-flex">
          <li class="color-list active" @click="colorClick(1)">白色</li>
          <li class="color-list">黑色</li>
          <li class="color-list">蓝色</li>
        </ul>
      </li>
      <li class="cart-list">
        <p class="count-lf">数量</p>
        <ul class="count-rt">
          <li class="icon iconfont icon-jian" @click="decrement"></li>
          <li class="count-text">{{ count }}</li>
          <li class="icon iconfont icon-jia" @click="increment"></li>
        </ul>
      </li>
      <li class="cart-list">
        <p class="list-top">颜色</p>
        <ul class="list-flex">
          <li class="color-list active" @click="colorClick(1)">白色</li>
          <li class="color-list">黑色</li>
          <li class="color-list">蓝色</li>
        </ul>
      </li>
      <li class="cart-list line">
        <p class="count-lf">数量</p>
        <ul class="count-rt">
          <li class="icon iconfont icon-jian" @click="decrement"></li>
          <li class="count-text">{{ count }}</li>
          <li class="icon iconfont icon-jia" @click="increment"></li>
        </ul>
      </li>
      <li class="cart-foot">
        <button class="btn yellow" type="warn"> 合计：￥404.00 </button>
        <button class="btn " type="warn" @click="warn"> OK！就要这些 </button>
      </li>
    </ul>
  </div>

</template>

<script>
  // Use Vuex
  import store from './store'
  export default {
    props: {
      show: {
        type: Number,
        default: 0
      }
    },
    data () {
      return {
        listShow: true,
        color: [
          1,
          2,
          3
        ],
        colorId: 1,
        animation: '',
        animationData: ''
      }
    },
    components: {
    },

    created () {

    },
    computed: {
      count () {
        return store.state.count
      }
    },
    methods: {
      increment () {
        store.commit('increment')
      },
      decrement () {
        store.commit('decrement')
      },
      colorClick (id) {
        this.colorId = id
      },
      hideList () {
        this.listShow = false
      }
    },
    mounted () {

    }
  }
</script>

<style lang="less" rel="stylesheet/less" scoped>
  .cart-bg{
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    background: #fff;
    .cart-list{
      margin: 20rpx;
      .list-top,.count-lf{
        font-size: 32rpx;
        line-height: 80rpx;
      }
      .list-flex{
        display: flex;
        flex-direction: row;
        .color-list{
          width: 100rpx;
          height: 60rpx;
          margin: 10rpx;
          font-size: 24rpx;
          line-height: 60rpx;
          text-align: center;
          color: #999;
          border: 1rpx solid #D7D6DC;
          border-radius: 6rpx;
        }
        .active{
          color:#E93B3D;
          border: 1rpx solid #E93B3D;
        }
      }
      .count-lf{
        float: left;
      }
      .count-rt{
        float: right;
        display: flex;
        flex-direction: row;
        .icon{
          line-height: 80rpx;
          font-size: 80rpx;
          color:#999;
          &:active{
            color: #E93B3D;
          }
        }
        .count-text{
          font-size: 32rpx;
          line-height: 80rpx;
        }
      }
      &:after{
        content: "";
        display: block;
        clear: both;
      }
    }
    .line {
      border-bottom: 1rpx solid #D7D6DC;
    }
    .cart-foot{
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      button.btn{
        width: 340rpx;
        line-height: 90rpx;
        margin: 10rpx;
        padding: 0;
      }
      .yellow{
        background: #FF9600;
      }
    }
  }

  .list-mask{
    position:fixed;
    top: 0;
    left:0;
    width:100%;
    height:100%;
    z-index:40;
    backdrop-filter:blur(10px);
    background:rgba(7, 17, 27, 0.6);
  }
</style>
